<%@ Control Language="C#" %>
<%@ Import Namespace="CommunityServer.Controls" %>
<%@ Import Namespace="CommunityServer.Components" %>
<%@ Register TagPrefix="CS" Namespace="CommunityServer.Controls" Assembly="CommunityServer.Controls" %>

<div align="center">
<div class="CommonContentArea" style="width:650px;">
<h2 class="CommonTitle">
	<CS:ResourceControl runat="server" ResourceName="CreateNewAccount_Title" />
</h2>

<div class="CommonContent">
<div class="CommonFormArea" >
<div class="CommonFormFieldDescription"><CS:ResourceControl runat="server" ResourceName="CreateNewAccount_Instructions" ID="Resourcecontrol8"/></div>

<h4 class="JoinTitle"><CS:ResourceControl runat="server" ResourceName="CreateNewAccount_Required" ID="Resourcecontrol11"/></h4>
<div class="JoinArea">
	<table cellpadding="0" cellspacing="0" border="0">
	<tr>
		<td align="right">
			<CS:ResourceControl runat="server" ResourceName="CreateNewAccount_UserName" ID="Resourcecontrol2"/>
		</td>
		<td align="left">
			<div class="CommonFormField">
				<asp:textbox id="Username" MaxLength="64" runat="server" columns="40" onKeyUp ="validateForm(this);"></asp:textbox>
				<asp:RequiredFieldValidator EnableClientScript="false" id="usernameValidator" runat="server" ControlToValidate="Username" Cssclass="validationWarning">*</asp:RequiredFieldValidator>
				<asp:RequiredFieldValidator EnableClientScript="false" id="placeHolderValidator" runat="server" ControlToValidate="Username" Cssclass="validationWarning" >*</asp:RequiredFieldValidator>
				<asp:RegularExpressionValidator EnableClientScript="false" id="usernameRegExValidator" runat="server" ControlToValidate="Username" Cssclass="validationWarning">*</asp:RegularExpressionValidator>
				<asp:CustomValidator ControlToValidate="Username" id="UsernameLengthValidator" EnableClientScript=false runat="server">*</asp:CustomValidator>
			</div>
		</td>
	</tr>
	<tr id="AccountActivationAutomatic" Visible="false" runat="server">
		<td align="right">
				<CS:ResourceControl runat="server" ResourceName="CreateNewAccount_PasswordDescription" ID="Resourcecontrol3"/>
		</td>

		<td align="left">
			<div class="CommonFormField">
				<asp:textbox id="Password" MaxLength="64" TextMode="Password" runat="server" columns="40" onKeyUp ="validateForm(this);"></asp:textbox>
				<asp:RequiredFieldValidator id="passwordValidator" runat="server" ControlToValidate="Password" Cssclass="validationWarning">*</asp:RequiredFieldValidator>
				<asp:RegularExpressionValidator EnableClientScript="false" id="passwordRegExValidator" runat="server" ControlToValidate="Password" Cssclass="validationWarning">*</asp:RegularExpressionValidator>
				<asp:CustomValidator ControlToValidate="Password" id="passwordContentValidator" EnableClientScript=false runat="server" Display=Dynamic Cssclass="validationWarning">*</asp:CustomValidator>
			</div>
		</td>
	</tr>
	<tr id="AccountActivationAutomatic2" Visible="false" runat="server">
		<td align="right">
				<CS:ResourceControl runat="server" ResourceName="CreateNewAccount_ReEnterPassword" ID="Resourcecontrol4"/>
		</td>
		<td align="left">
			<div class="CommonFormField">
				<asp:textbox id="Password2" MaxLength="64" TextMode="Password" runat="server" columns="40" onKeyUp ="validateForm(this);"></asp:textbox>
				<asp:RequiredFieldValidator id="password2Validator" runat="server" ControlToValidate="Password2" Cssclass="validationWarning">*</asp:RequiredFieldValidator>
				<asp:comparevalidator id="ComparePassword" runat="server" ControlToValidate="Password2" ControlToCompare="Password" Cssclass="validationWarning">*</asp:comparevalidator>
			</div>
		</td>
	</tr>
	<tr>
		<td align="right">
				<CS:ResourceControl runat="server" ResourceName="CreateNewAccount_Email" ID="Resourcecontrol5"/>
		</td>
		<td align="left" colspan="2">
			<div class="CommonFormField">
				<asp:textbox id="Email" runat="server" MaxLength="128" columns="40" onKeyUp ="validateForm(this);"></asp:textbox>
				<CS:ResourceControl runat="server" ResourceName="CreateNewAccount_EmailDescription" ID="Resourcecontrol6"/>
				<asp:RequiredFieldValidator id="emailValidator" runat="server" ControlToValidate="Email" Cssclass="validationWarning">*</asp:RequiredFieldValidator>
				<asp:RegularExpressionValidator id="emailRegExValidator" runat="server" ControlToValidate="Email" Cssclass="validationWarning" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
			</div>
		</td>
	</tr>
	<tr>
		<td align="right">
				<CS:ResourceControl runat="server" ResourceName="CreateNewAccount_ReEnterEmail" ID="Resourcecontrol7"/>
		</td>
		<td align="left" colspan="2">
			<div class="CommonFormField">
				<asp:textbox id="Email2" runat="server" MaxLength="128" columns="40" onKeyUp ="validateForm(this);"></asp:textbox>
				<asp:RequiredFieldValidator id="email2Validator" runat="server" ControlToValidate="Email2" Cssclass="validationWarning">*</asp:RequiredFieldValidator>
				<asp:comparevalidator id="CompareEmail" runat="server" ControlToValidate="Email2" ControlToCompare="Email" Cssclass="validationWarning">*</asp:comparevalidator>
			</div>
		</td>
	</tr>
	<tr>
		<td align="right">
			<cs:resourcecontrol runat="server" resourcename="CreateNewAccount_Timezone" id="Resourcecontrol1" name="Resourcecontrol1"/>
		</td>
		<td>
			<div class="CommonFormField">
			<cs:timezonedropdownlist id="Timezone" runat="server" />
			</div>
		</td>
	</tr>
	<asp:PlaceHolder Runat="server" ID="ContactCheckboxes">
		<tr>
			<td align="right">
				<cs:resourcecontrol runat="server" resourcename="CreateNewAccount_AllowSiteToContact" id="Resourcecontrol9" name="Resourcecontrol1"/>
			</td>
			<td	align="left" colspan="2">
				<div class="CommonFormField">
				<cs:yesnoradiobuttonlist id="AllowSiteToContact" runat="server" repeatcolumns="2" cssclass="txt1" />
				</div>
			</td>
		</tr>
		<tr>
			<td align="right">
				<cs:resourcecontrol runat="server" resourcename="CreateNewAccount_AllowSitePartnersToContact" id="Resourcecontrol10" name="Resourcecontrol1"/>
			</td>
			<td align="left" colspan="2">
				<div class="CommonFormField">
				<cs:yesnoradiobuttonlist id="AllowSitePartnersToContact" runat="server" repeatcolumns="2" cssclass="txt1" />
				</div>
			</td>
		</tr>
	</asp:PlaceHolder>
	<tr runat="server" id="RulesSection">
		<td align="right">
			<cs:resourcecontrol runat="server" resourcename="CreateNewAccount_ForumRules" id="Resourcecontrol18" name="Resourcecontrol1"/>
		</td>
		<td>
			<asp:CheckBox id="AcceptAgreement" Runat="server" onClick ="validateForm(this);" /><asp:HyperLink runat="server" id="AcceptAgreementLink"  />
			<CS:RequiredCheckBoxValidator EnableClientScript="false" id="RequiredAcceptAgreement" runat="server" ControlToValidate="AcceptAgreement" Cssclass="validationWarning">*</CS:RequiredCheckBoxValidator>
		</td>
	</tr>

	<tr>
		<td class="CommonFormFieldDescription" align="left" colspan="2">
			<asp:ValidationSummary id="validationSummary" runat="server" />
		</td>
	</tr>
	</table>
</div>

</div>
</div>
</div>
		<asp:button CssClass="CommonBigButton" id="CreateAccount" Runat="server" disabled="disabled" />
</div>

</div>

<script type = "text/javascript">

function validateForm(item)
{
	var state = true;
	if(item.value == '')
		state = false;

	if(state){ state = checkInput('<%= Username.ClientID %>');}
	if(state){ state = checkInput('<%= Password.ClientID %>');}
	if(state){ state = checkInput('<%= Password2.ClientID %>');}
	if(state){ state = checkInput('<%= Email.ClientID %>');}
	if(state){ state = checkInput('<%= Email2.ClientID %>');}

	if(state)
	{
		var cb = $('<%= AcceptAgreement.ClientID %>');
		if(cb != null)
		    state = cb.checked;

	}


	$('<%= CreateAccount.ClientID %>').disabled = !state;
}

function checkInput(id)
{
	var item = $(id);
	return item == null || item.value.replace(/^\s+|\s+$/g, '') != '';
}

</script>